package Swing;
import java.awt.Color;

import javax.swing.*;
public class menuExam {
	static final int WIDTH=300;
	static final int HEIGHT=200;
	public static void main(String[] args) {
		JFrame jf = new JFrame();
		jf.setSize(WIDTH,HEIGHT);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.setTitle("menu example");
		JMenuBar menubar1 = new JMenuBar();
		jf.setJMenuBar(menubar1);
		JMenu menu1 = new JMenu("Files");
		JMenu menu2 = new JMenu("Edit");
		JMenu menu3 = new JMenu("View");
		menubar1.add(menu1);
		menubar1.add(menu2);
		menubar1.add(menu3);
		
		JMenuItem item1 = new JMenuItem("Open...");
		JMenuItem item2 = new JMenuItem("Save");
		JMenuItem item3 = new JMenuItem("Print");
		JMenuItem item4 = new JMenuItem("Exit");
		menu1.add(item1);
		menu1.add(item2);
		menu1.addSeparator();
		menu1.add(item3);
		menu1.addSeparator();
		menu1.add(item4);
		
		JPanel contentPane = new JPanel();
		jf.setContentPane(contentPane);
		JButton button1 = new JButton("Yes");
		JButton button2 = new JButton("Cancel");
		contentPane.add(button1);
		contentPane.add(button2);
		button1.setToolTipText("Click it for sure.");
		button1.setBorder(BorderFactory.createLineBorder(Color.red));
		button2.setToolTipText("Cancel the operations.");
		
		JTextArea textarea = new JTextArea();
		contentPane.add(textarea);
		
		jf.setVisible(true);
	}
}